{template "header-huiyuan.html"}
{template "fanhui-index.html"}
<div class="d-container">
	<div class="d-row">
		<div class="col-md-6 col-md-offset-3  d-yuanjiao-20">
			<div class="row">
				<div class="d-yuanjiao-10 d-kuan d-bianhua-20 ">
					<div class="portlet light ">
					    <div class="portlet-title">
					        <div class="caption">
					            <span class="caption-subject"> 支付密码</span>
					        </div>
					    </div>
					    <div class="portlet-body form fc-form">
					        <form action="" class="form-horizontal" method="post" name="myform" id="myform">
					            {$form}
					
					            {if $member.zhifumima}
					            <div class="form-group" id="dr_row_password">
					                <label class="col-md-12 control-label"> 原支付密码 </label>
					                <div class="col-md-12">
					                    <input type="password" id="dr_password_old" placeholder="6位 原支付密码 ..." class="form-control input-large password-input"  name="data[zhifumima]" maxlength="6">
					                    <div id="dr_password_old_error" style="color:red;"></div>
									</div>
					            </div>
					            {/if}
					            <div class="form-group" id="dr_row_password2">
					                <label class="col-md-12 control-label"> 新支付密码 </label>
					                <div class="col-md-12">
					                    <input type="password" id="dr_password_new" placeholder="6位 支付密码 ..." class="form-control input-large password-input"  name="data[zhifumima2]" maxlength="6">
					                    <span id="dr_password_new_error" style="color:red;"></span>  
									</div>
					            </div>
					            <div class="form-group" id="dr_row_password3">
					                <label class="col-md-12 control-label"> 确认支付密码 </label>
					                <div class="col-md-12">
					                    <input type="password" id="dr_password_confirm" placeholder="6位 确认支付密码 ..." class="form-control input-large password-input"  name="data[zhifumima3]" maxlength="6">
					                    <span id="dr_password_confirm_error" style="color:red;"></span>
									</div>
					            </div>
					
					            <div class="form-actions fc-form-actions">
					                <label class="col-md-12 control-label">  </label>
					                <div class="col-md-12 fc-form-submit">
					                    <button type="button" onclick="dr_ajax_submit('{dr_now_url()}', 'myform', '2000')" class="btn blue d-kuan"> 提交保存 </button>
					                </div>
					
					            </div>
					        </form>
					    </div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<style>
	.input-large {
	    width: 100%!important;
	}
	.form-horizontal .form-group {
	    margin-left: -5px;
	    margin-right: -5px;
	}
	.form-control {
	    width: 100%;
	    height: 45px;
	    padding: 6px 12px;
	    background-color: #f3f4f7;
	    border: 1px solid #f3f4f7;
	    -webkit-box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%);
	    -webkit-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
	    -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
	    transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
	}
</style>
<script>
	$(document).ready(function() {  
	    $('.password-input').on('input', function() {  
	            var $this = $(this);  
	            var password = $this.val();
				
	            var errorId = $this.attr('id') + '_error';  
	            
	            // 使用正则表达式检查密码是否只包含数字（可选）  
	            var regex = /^\d{1,6}$/; // 匹配1到6个数字的正则表达式 
				var shuru = regex.test(password);
				this.value = this.value.replace(/[^\d]/g, '');
	            
				if (password.length > 6) {
				    // 如果密码长度超过6位，则截断到6位并显示错误消息（如果需要）  
				    $this.val(password.substring(0, 6));  
				    $('#' + errorId).text('密码不能超过6位');  
					console.log('errorId',errorId);
				}
				if(!regex.test(password)){
					$('#' + errorId).html('<span>密码为6为数字</span>'); 
				} else {
					if (password.length < 6) {
						$('#' + errorId).html('<span>支付密码为6位数字</span>');
					}
					if (password.length == 6) {
						$('#' + errorId).html('');
					}
				}
				
	        });    
	});
</script>
{template "fanhui.html"}
{template "mfooter.html"}